def findMax(matrix):
    max_item = matrix[0][0]
    max_xys = []
    n = len(matrix)
    for i in range(n):
        for j in range(len(matrix[0])):
            if matrix[i][j] > max_item:
                max_item = matrix[i][j]
                max_xys.clear()
                max_xys.append((i,j))
            elif matrix[i][j] == max_item:
                max_xys.append((i,j))
    return max_item, tuple(max_xys)

def main():
    n = eval(input())
    matrix = []
    for i in range(n):
        row = [ eval(x) for x in input().split() ]
        matrix.append(row)
    max_value, max_indexes = findMax(matrix)
    print(max_value)
    for item in max_indexes:
        print(item[0],item[1],sep=',')

if __name__ == "__main__":
    main()
